/**
 * 
 */
package org.iridium.allcomments.persistance;

import java.util.HashSet;
import java.util.List;

/**
 * @author iridium
 * 
 */
public interface CommentsDAO {

	/**
	 * insert a record to table 'comments'
	 * 
	 * @param userId
	 *            user ID
	 * @param commentId
	 *            comment ID
	 * @param preCommentId
	 *            previous comment ID
	 * @param url
	 *            url of the commented page
	 * @param content
	 *            content of the comment
	 * @param ip
	 *            IP address from
	 */
	void addItem(long userId, String commentId, String preCommentId,
			String url, String content, String ip);

	/**
	 * delete an item if 'comment id' equals commentId this operation will
	 * delete all the following items.
	 * 
	 * @param commentId
	 */
	void delItem(String commentId);

	/**
	 * alter content of a comment post
	 * 
	 * @param commentId
	 * @param content
	 */
	void updateContent(String commentId, String content);

	/**
	 * update tags of a comment
	 * 
	 * @param commentId
	 * @param tags
	 */
	void updateTags(String commentId, String tags);

	/**
	 * update tags of a comment
	 * 
	 * @param commentId
	 * @param tags
	 */
	void updateTags(String commentId, HashSet<String> tags);

	/**
	 * delete all items post by user
	 * 
	 * @param userId
	 */
	void delItemFromOne(long userId);

	/**
	 * clean all tags of one user
	 * 
	 * @param userId
	 */
	void delTagsFromOne(long userId);

	/**
	 * query tags of a user
	 * 
	 * the element of returned list: [comment id, tags]
	 * 
	 * @param userId
	 * @return a list.
	 */
	public List<String[]> queryTagsFromOne(long userId);
}
